Turn off shareable-edit (help)

Hello,

I'm trying to fully turn off shareable-edit I believe the following code will do the trick. Am I overlooking anything? Thank you.

-Jim
 

pragma runLim,0 
 
Module m = current
m = edit(fullName m, true)
if (null m){ack "{null} Parameter for current module!";halt;}
 
if (null current Module) {ack "Please run this program from a module";halt;} 
else if (!isEdit current) {ack "current module must be editable to set permissions";halt;}
 
void inhertTable(Object o)
{
    if (table o) 
        { 
                Object tbl= getTable (o) 
                inherited tbl 
                Object rowHead 
                
                for rowHead in table tbl do {inherited rowHead}
        }
}
 
void main(Module m)
{
        load view "Standard view"
        Object o
        for o in entire m do {
                string err
                err = set(o,read|write|change,null) // null means alter the
                inherited o
                inhertTable(o)
                                                                                        // default ACL record
                if (!null err) {
                        ack "problem setting default ACL: " err
                        halt
                }
        }
}
 
/*************************************************      
                                        MAIN
*************************************************/
 
main(m)
save(m) // Saving...
close(m) // Closing...

SystemAdmin - Mon Aug 06 14:38:44 EDT 2012

Re: Turn off shareable-edit (help)
Mathias Mamsch - Mon Aug 06 16:22:17 EDT 2012

Hmm I guess:
 

pragma runLim,0 
 
Module m = current
if (!isEdit m) m = edit(fullName m, true, true) // silent  
if (null m){ack "Could not edit current module!";halt;}
 
Object o
for o in entire m do inherited o
save m

 


would have done the trick. You do not need to:

 

 

  • load the standard view (code will work regardless of view)
  • set the access rights for everyone if you set it to inherited anyway
  • handle tables specially (can be treated like any other object)
  • close the current Module (what a nasty thing to do)


Maybe that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Turn off shareable-edit (help)
SystemAdmin - Mon Aug 06 17:30:14 EDT 2012

Mathias Mamsch - Mon Aug 06 16:22:17 EDT 2012

Hmm I guess:
 

pragma runLim,0 
 
Module m = current
if (!isEdit m) m = edit(fullName m, true, true) // silent  
if (null m){ack "Could not edit current module!";halt;}
 
Object o
for o in entire m do inherited o
save m

 


would have done the trick. You do not need to:

 

 

  • load the standard view (code will work regardless of view)
  • set the access rights for everyone if you set it to inherited anyway
  • handle tables specially (can be treated like any other object)
  • close the current Module (what a nasty thing to do)


Maybe that helps, regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

here is the original code but it didn't work on the tables; is it because the for loop wasn't using "entire"?

-Jim
 

if (null current Module) {
    ack "Please run this program from a module"
    halt
} else if (!isEdit current) {
    ack "current module must be editable to set permissions"
 
    halt
}
Object o
string modName = (current Module)."Name" ""
for o in current Module do {
    string err
    err = set(o,read|write|change,null) // null means alter the
    inherited o
                                        // default ACL record
    if (!null err) {
        ack "problem setting default ACL: " err
        halt
    }
}
save current          // save our work

Re: Turn off shareable-edit (help)
Mathias Mamsch - Tue Aug 07 04:08:03 EDT 2012

SystemAdmin - Mon Aug 06 17:30:14 EDT 2012

here is the original code but it didn't work on the tables; is it because the for loop wasn't using "entire"?

-Jim
 

if (null current Module) {
    ack "Please run this program from a module"
    halt
} else if (!isEdit current) {
    ack "current module must be editable to set permissions"
 
    halt
}
Object o
string modName = (current Module)."Name" ""
for o in current Module do {
    string err
    err = set(o,read|write|change,null) // null means alter the
    inherited o
                                        // default ACL record
    if (!null err) {
        ack "problem setting default ACL: " err
        halt
    }
}
save current          // save our work

Yes, the for obj in Module loop will only iterate over visible objects, i.e. the cells. Since it will not reset the table head, access will not properly be inherited to the cells. If you use "for obj in entire Module" then all objects will be reset. See also DXL help. Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Turn off shareable-edit (help)
llandale - Tue Aug 07 10:49:43 EDT 2012

This code does not "disallow" shared edit. It removes all shared sections. Someone who opens the module "shared" will not be able to change anything. I suppose you can "disallow" shared edit with some kind of post-module-open trigger that downgrades them to "read".

Mathias is right.

The "for o in entire m do" loop grabs all objects. Not in this case, but generally you want to add:
  • if (isDeleted(o)) continue
  • if (table(o) or row(o) or cell(o)) continue
  • if (for some other reason I don't like this object) continue

The "for i in m do" loop respects the current display set. That puts the code at the mercy of the current view, which for me is unacceptable the vast majority of the time; thus I routinely use "entire".

Your lines 6 and 7 should refer to "m" not "current".
Swap lines 4 and 5.
You don't need function inheritTable(). But if you did you don't need getTable() (o is already the table object), and you do need a "for oCell in rowHead do {inherited oCell}" statement

-Louie